export default {
  state: {
    writingType: JSON.parse(localStorage.getItem('writingType') || 'null'),
    typeList: JSON.parse(localStorage.getItem('writingTypeList') || 'null'), //文章类型列表
  }, //跨组件共享的数据包

  reducers: {
    updateWritingType(state: any, { payload }) {
      // 将数据存储在 Local Storage 中
      localStorage.setItem('writingType', JSON.stringify(payload));
      return {
        ...state,
        writingType: payload,
      };
    },
    updateTypeList(state: any, { payload }) {
      localStorage.setItem('writingTypeList', JSON.stringify(payload));
      return {
        ...state,
        typeList: payload,
      };
    },
  },
  effects: {
    //异步 action，用来发送异步请求
  },
};
